<?php
define('ROOT',dirname(__FILE__));
define('DOMAIN','yiicms.com');
define('SITENAME','网站名-config中定义');
return array(
    'basePath' => APP_ROOT . '/protected',
    'runtimePath' => ROOT.'/runtime',
    'preload' => array('log'), // 预加载日志模块
    'language' => 'zh',
    'import' => array(
        'application.modules.*',
		'system.modules.*',
		'system.models.*',
    ),
    'components' => array(
        'db' => array(
            'class' => 'CDbConnection',
			'connectionString' => 'mysql:host=localhost;dbname=yiicms_zh',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => '',
            'schemaCachingDuration' => 3600, // 数据缓存时间
            'enableProfiling' => FALSE, // 是否开启数据缓存
        ),
        'urlManager' => array(
            'urlFormat' => 'path',
            'showScriptName' => FALSE,
            //'urlSuffix' => '.html',// URL结尾符号
            'rules' => include APP_ROOT.'/protected/config/url.php',
        ),
        'request' => array(
            'enableCookieValidation' => TRUE, // 防止Cookie攻击,要用CHttpCookie
        ),
        'log' => array(
            'class' => 'CLogRouter',
            'routes' => array(
                array(
                    'class' => 'CFileLogRoute', // 文件记录日志
                    'levels' => 'error',
                    'categories' => 'system.*',
                ),
                array(
                    'class' => 'CDbLogRoute',
                    'levels' => 'error, warning, trace, info',
                    'categories' => 'system.*',
                    'logTableName' => 'log',
                    'connectionID' => 'db',
                    'autoCreateLogTable' => TRUE,
                    'enabled' => TRUE,
                ),
            ),
        ),
        'session' => array(
            'class' => 'CDbHttpSession', // 基于数据库的session
            'connectionID' => 'db',
            'sessionTableName' => 'user_session',
            'autoCreateSessionTable' => TRUE,
        ),
        'user' => array(
            'allowAutoLogin' => TRUE, // enable cookie-based authentication
            'identityCookie' => array('domain' => '.'.DOMAIN),
        ),
        'cache' => array(
            'class' => 'CFileCache', //文件缓存
            'cachePath' =>  ROOT.'/runtime/cache',// 缓存目录
            'directoryLevel' => '1', // 缓存文件的目录深度
        ),
        'request' => array(
            'enableCookieValidation' => TRUE, // 防止Cookie攻击,要用CHttpCookie
        ),
        'assetManager' => array(
            'BasePath' => ROOT . '/static/assets',
            'baseUrl' => '/static/assets',
        ),
    ),
    // 加载全局变量
    // 调用方法 Yii::app()->params['paramName']
    'params' => array(
        //数据库设置
        'dsn' => 'mysql:host=localhost;charset=utf8;dbname=%s',
        'dbuser' => 'root',
        'dbpwd' => '',
        'dbprefix' => 'yiicms_',
        //默认语言（多语言设置）
        'default_language' => 'zh',
        'langs' => array(
            'zh'=>'中文',
            'en'=>'英文'
            ),
        //域名设置
		'domain' => 'http://www.'.DOMAIN,
		'admindomain' => 'http://admin.'.DOMAIN,
		'imgdomain' => 'http://img.'.DOMAIN,
    	'imgpath' => ROOT.'/images',
    ),
);